package com.luo.bbs.front.webapi.rabbitmq;

import com.luo.bbs.front.webapi.mapper.CollectMapper;
import com.luo.pojo.Collect;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = {RabbitMQConfig.COLLECT_QUEUE1})
public class Consumer1 {
    @Autowired
    private CollectMapper collectMapper;

    @RabbitHandler
    public void saveCollect(Collect collect){
        System.out.println(collect);
        System.out.println("消息接收完成");
        collectMapper.insert(collect);
    }
}
